import http from "@/common/http/request";
import { addQuestionInterface, allocationProductInterface, allocationProductRecordInterface, questionListInterface, questionUpdateInterface } from "./question.interface";

//问题列表
export const $getQuestionList = (data: questionListInterface) => {
  const $http = new http();
  return $http.get({
    url: '/hlas/question/list',
    data,
  })
}

//问题详情
export const $QuestionDetail = (id: number) => {
  const $http = new http();
  return $http.get({
    url: `/hlas/question/${id}`,
  })
}

//编辑问题
export const $questionUpdate = (data: questionUpdateInterface) => {
  const $http = new http();
  return $http.put({
    url: '/hlas/question',
    data,
  })
}

//新增问题
export const $AddQuestion = (data: addQuestionInterface) => {
  const $http = new http();
  return $http.post({
    url: '/hlas/question',
    data,
  })
}

//删除产品分类
export const $questionDelete = (data: Array<string>) => {
  const $http = new http();
  return $http.delete({
    url: `/hlas/question/${data.join(',')}`,
  })
}

//问题分配产品
export const $allocationProduct = (data: allocationProductInterface) => {
  const $http = new http();
  return $http.post({
    url: '/hlas/question/allocationProduct',
    data,
  })
}


//问题分配产品记录
export const $allocationProductRecord = (data: allocationProductRecordInterface) => {
  const $http = new http();
  return $http.get({
    url: '/hlas/question/allocationProduct',
    data,
  })
}